<template>
    <view :style="{ direction: $t('dir') }" :class="$t('dir') == 'rtl' ? 'rtl' : 'ltr'">
        <navbar :title="$t(title)"> </navbar>
        <view class="main agreement">
            <u-parse :content="content"></u-parse>
        </view>
    </view>
</template>

<script>
export default {
    data() {
        return {
            type: 'agreement',
            content: '',
            title: '',
        }
    },
    created() {},
    mounted() {},
    onReady() {},
    onLoad(e) {
        this.type = e.type
        this.getSettingData()
        if (this.type == 'aboutUs') {
            this.title = 'aboutUs'
        } else if (this.type == 'privacyPolicy') {
            this.title = 'privacyPolicy'
        } else {
            this.title = 'userAgreement'
        }
    },
    onShow() {},
    methods: {
        async getSettingData() {
            uni.showLoading()
            await this.$uniapi('/setting').then((res) => {
                uni.hideLoading()
                if (res.code == 0) {
                    if (this.type == 'aboutUs') {
                        this.title = 'aboutUs'
                        this.content = res.data['aboutus' + this.$t('k1')]
                    } else if (this.type == 'privacyPolicy') {
                        this.title = 'privacyPolicy'
                        this.content = res.data['privacy_policy' + this.$t('k1')]
                    } else {
                        this.title = 'userAgreement'
                        this.content = res.data['user_agreement' + this.$t('k1')]
                    }
                }
            })
        },
    },
}
</script>
<style scoped lang="scss">
.agreement {
    padding-bottom: 112rpx;
}
</style>